package com.chenl.consumer.vo;

import lombok.*;

import java.io.Serializable;

@Builder
@ToString
@AllArgsConstructor
public class Result<T> implements Serializable {

    @Getter
    @Setter
    private int code = 200;

    @Getter
    @Setter
    private Object msg = "success";

    @Getter
    @Setter
    private T data;

    public Result() {
        super();
    }

    public Result(T data) {
        super();
        this.data = data;
    }

    public Result(T data, String msg) {
        super();
        this.data = data;
        this.msg = msg;
    }
    public Result(Integer code, String msg, T data) {
        super();
        this.data = data;
        this.msg = msg;
        this.code = code;
    }


    public Result(int code, T data) {
        super();
        this.data = data;
        this.code = code;
    }
    /**
     * 参数错误
     * @param msg 返回错误信息
     */
    public Result(String msg){
        super();
        this.code=500;
        this.msg=msg;
    }
    /**
     *
     * @param msg  错误信息
     * @param code 错误码
     */
    public Result(int code, String msg){
        super();
        this.code=code;
        this.msg=msg;
    }

}